package cn.topevery.garden.dal.logic;

import cn.topevery.garden.dal.dao.DiseaseFileDao;
import cn.topevery.garden.entity.po.DiseaseFile;
import cn.topevery.garden.entity.query.DiseaseFileQuery;
import cn.topevery.garden.entity.vo.DiseaseFileVO;
import cn.topevery.garden.framework.base.BaseLogic;
import hw.topevery.framework.db.base.BaseEntityDao;
import hw.topevery.framework.db.entity.DataPager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 病虫害附件
 *
 * @author code-generate
 * @date 2022-01-05
 */
@Service
public class DiseaseFileLogic extends BaseLogic<DiseaseFile> {
    @Autowired
    DiseaseFileDao diseaseFileDao;

    @Override
    public BaseEntityDao<DiseaseFile, Integer> getDao() {
        return diseaseFileDao;
    }

    

    /**
     * 获取列表
     *
     * @param query
     */
    public DataPager<DiseaseFileVO> listPage(DiseaseFileQuery query) {
        return diseaseFileDao.listPage(query);
    }

    /**
     * 根据自增id批量删除
     *
     * @param ids
     */
    public void deleteBatchById(String userId,Integer[] ids) {
        diseaseFileDao.delete(userId, ids);
    }

    /**
     * 根据自增id保存或者更新
     *
     * @param diseaseFile 实体
     */
    public void saveOrUpdate(String userId, DiseaseFile diseaseFile){
        diseaseFileDao.saveOrUpdate(userId,diseaseFile);
    }

    /**
         * 根据自定义列值来获取对象
         */
    public DiseaseFile getEntityByColumn(String key, String value) {
        return diseaseFileDao.getEntityByColumn(key, value);
    }

    public List<DiseaseFile> getListByMainId(Integer mainId) {
        return diseaseFileDao.getListByMainId(mainId);
    }

    public void insert(DiseaseFile diseaseFile) {
        diseaseFileDao.insert(diseaseFile);
    }

    public void insertList(List<DiseaseFile> list) {
        diseaseFileDao.insertList(list);
    }

    public void deleteByMainId(Integer mainId, Integer userId) {
        diseaseFileDao.deleteByMainId(mainId, userId);
    }

}
